package com.nf.action;

import com.nf.entity.Student;
import com.nf.server.StudentServer;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import java.util.List;

@Controller
@Scope("prototype")
public class StudentAction extends ActionSupport{
   @Autowired
   private StudentServer studentServer = null;
   @Override
    public String execute() throws Exception{
       List<Student> studentList = studentServer.getAllStudent();
       System.out.println(studentList.size());

       ActionContext.getContext().getValueStack().set("studentList",studentList);
       return this.SUCCESS;
   }
}
